package com.lc.pianostudent.conn;

import com.lc.pianostudent.bean.AnswerResultBean;
import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Created by Administrator on 2018/2/22.
 */
@HttpInlet(Conn.ACTION_ACTION)
public class PostActionAction extends BaseAsyPost {

    public String user_id;
    public PostActionAction(AsyCallBack asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected PostActionActionInfo parser(JSONObject object) throws Exception {
        if (object.optString("code").equals("200")) {

            PostActionActionInfo info = new PostActionActionInfo();

            info.code = object.optString("code");
            info.check = object.optString("check");
            if(info.check.equals("true")){
                JSONObject jsonObject = object.optJSONObject("list");
                info.id = jsonObject.optString("id");
                info.userid = jsonObject.optString("userid");
                info.time = jsonObject.optString("time");
                info.number = jsonObject.optString("number");
                info.wealth = jsonObject.optString("wealth");
                info.xx = jsonObject.optString("xx");
                info.checkinfo = jsonObject.optString("checkinfo");
                info.create_time = jsonObject.optString("create_time");
                info.renzhen = jsonObject.optString("renzhen");
                info.zhixing = jsonObject.optString("zhixing");
                info.text = jsonObject.optString("text");
            }

            TOAST = object.optString("message");
            return info;

        } else {

            TOAST = object.optString("message");

        }

        return null;
    }

    public static class PostActionActionInfo {

        public String code,check,id,userid,time,number,wealth,xx,checkinfo,create_time,renzhen,zhixing,text;

    }

}
